Applications commonly are built using object-oriented programming languages, wherein information is often modeled as domain objects. Such objects can be utilized to encapsulate information (e.g., business related), wherein various components can manipulate these objects during the process of implementing use cases. In many instances, it is desirable to build such applications such that the information is expressed in the form of markup language, such as XML (Extensible Markup Language) or SGML (Standard Generalized Markup Language) artifact, for example.
Today, there are a variety of technologies that generate XML artifacts from object code or instances of object code and process the XML artifacts. For example, standard APIs (Application Program Interfaces) such as SAX (Simple API for XML) and DOM (Document Object Model) are often employed. In addition, industry language standards such as XSL (Extensible Style Language) and XPath are commonly utilized. Furthermore, emerging technologies such as schema compilers and data binders, and homegrown XML programming APIs (which are often built on top of SAX and DOM) that simplify specific application needs are becoming more and more prevalent.
However, there often is a large impedance mismatch between the structure utilized to represent XML artifacts and objects. Thus, to enable programmers in the object world to work seamlessly in the XML world as if the XML representation were objects, this impedance mismatch must be resolved. One common technique utilized to bridge the gap is to employ a data-binding or mapping tool. Such tools typically provide some form of mapping between the XML and the object domains, or space. For example, given an XSD (XML Schema Definition) schema, a data binder can be utilized to serialize schema values to a type-declaration (e.g., class type) with corresponding field labels. In another example, a data binder can be utilized to generate the XSD schema from the type-declaration. This impedance mismatch is not limited to structural differences between XML and object domain representations. For example, this mismatch can be found between structures in relational, object, markup and/or user interface domains.
Because of the structure mismatch, suitable data-binding tools must provide users with at least some control over construct mappings. For example, the user may desire to utilize different field names for disparate domains, serialize particular fields to one or more attributes instead of child elements, prevent particular elements from being serialized, etc. Techniques to achieve such customization include annotating types and/or annotating schemas.
One particular difference between a markup language representation and an object-oriented representation that amplifies the structure mismatch is the fact that type-systems of mainstream object-oriented languages generally are nominal (named) types whereas many markup language constructs are anonymous constructs. Mapping between such different structures is not handled very well with conventional data-binding tools. For example, many conventional systems when generating objects from markup language interpret constraints for anonymous elements in the markup language representation as if the constraints were distributed over named child elements in the markup language representation. However, this interpretation can result in a completely different content model than what is intended by the original schema. Consequently, it might be impossible to ascertain whether the original schema was the anonymous schema with constraints for anonymous elements or whether the constraints were associated with the child elements. Thus, there is a need to provide more versatile data binding techniques that overcome the aforementioned shortcomings associated with conventional data binding systems.